/*
 * @Author: your name
 * @Date: 2020-12-29 11:18:54
 * @LastEditTime: 2020-12-29 17:51:07
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \H5 2010 studyd:\H5 2010 练习\第三阶段 Vue + node\DAY 7\panda\src\api\home.js
 */
import request from '@/utils/request'
import API from './constants'

// 请求首页页面数据
export const getHomePageData = () => {
  return request({ // 返回一个代表结果值的 promise 对象
    url: API.HOME_PAGE_API,
    params: {
      start: 0
    }
  })
}

// 请求分类数据
export const getCategories = () => {
  return request({
    url: API.CATEGORY_API
  }).then(res => res.list)
}

// 加载更多商品数据
export const getMore = start => {
  return request({
    url: API.RECOMMEND_PROD_API,
    params: {
      start,
      sort: 0
    }
  })
}
